﻿using University.Workshop.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data;
using University.Workshop.Model;
using University.Workshop.Business;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for ClientSearcherTest and is intended
    ///to contain all ClientSearcherTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ClientSearcherTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Search
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void SearchBlankTest()
        {
            string fullName = "";
            string id = "";
            string telephone = "";
            ClientManager.ValidateForSearching(fullName, id, telephone);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void SearchClientNullTest()
        {
            Client client = new Client();
            ClientManager.ValidateForSearching(client.FullName, client.ClientId, client.Telephone);
        }

        /// <summary>
        ///A test for SearchClient
        ///</summary>
        [TestMethod()]
        public void SearchClientTest()
        {
            Client client = new Client { FullName = "Daniel", ClientId = "123456", Telephone = "72123456" };  // TODO: Initialize to an appropriate value
            ClientSearcher.SearchClient(client);
        }

        [TestMethod()]
        public void SearchClientTest2()
        {
            Client client = new Client { FullName = "Daniel", ClientId = "123456", Telephone = "72123456" };  // TODO: Initialize to an appropriate value
            ClientManager.ValidateForSearching(client.FullName, client.ClientId, client.Telephone);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void SearchClientTest3()
        {
            Client client = null;
            ClientSearcher.SearchClient(client);
            
        }
    }
}
